package net.devkit.common.service.impl;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import net.devkit.common.dao.GenericDao;
import net.devkit.common.service.BaseServicer;

/**
 * 公共的服务接口的实现
 * 
 * @author shizeyuan
 * 
 * @param <T>
 * @param <ID>
 */
public abstract class BaseServicerImpl<T extends Serializable, ID extends Serializable>
		implements BaseServicer<T, ID> {

	protected GenericDao<T, ID> genericDao;

	public abstract void setGenericDao(GenericDao<T, ID> genericDao);

	@Override
	public ID create(T t) {
		return genericDao.create(t);
	}

	@Override
	public void createBatch(Collection<T> ts) {
		genericDao.createBatch(ts);
	}

	@Override
	public void remove(T t) {
		genericDao.remove(t);
	}

	@Override
	public void removeById(ID id) {
		genericDao.removeById(id);
	}

	@Override
	public void removeBatch(Collection<ID> ids) {
		genericDao.removeBatch(ids);
	}

	@Override
	public void modify(T t) {
		genericDao.modify(t);
	}

	@Override
	public void modifyBatch(Collection<T> ts) {
		genericDao.modifyBatch(ts);
	}

	@Override
	public void createOrModify(T t) {
		genericDao.createOrModify(t);
	}

	@Override
	public void createOrModifyBatch(Collection<T> ts) {
		genericDao.createOrModifyBatch(ts);
	}

	@Override
	public T loadEntityById(ID id) {
		return genericDao.loadEntityById(id);
	}

	@Override
	public T findEntityById(ID id) {
		return genericDao.findEntityById(id);
	}

	@Override
	public List<T> findAll() {
		return genericDao.findAll();
	}

	@Override
	public Long findCountAll() {
		return genericDao.findCountAll();
	}

	@Override
	public void flush() {
		genericDao.flush();
	}

	@Override
	public void clear() {
		genericDao.clear();
	}

}
